package com.wt.chat.config;

import com.wt.chat.schedule.AssignScheduleService;
import com.wt.chat.schedule.ChatExecutor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @description
 * @author: wangtao
 * @date:16:08 2019/11/19
 * @email:taow02@jumei.com
 */
@Component
public class AssignRunner implements ApplicationRunner {

	@Autowired
	private AssignScheduleService assignScheduleService;

	@Override
	public void run(ApplicationArguments args) throws Exception {
		while(true) {
			ChatExecutor.execute(assignScheduleService::assign);
			Thread.sleep(3000);
		}
	}
}
